package com.xrs.xrseducation.classgrades.controller;


import com.xrs.xrseducation.classgrades.entity.Classgrades;
import com.xrs.xrseducation.classgrades.service.impl.ClassgradesServiceImpl;
import com.xrs.xrseducation.util.LayuiUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 年级表 前端控制器
 * </p>
 *
 * @author jobob
 * @since 2020-09-18
 */
@RestController
@RequestMapping("/classgrades")
public class ClassgradesController {
    @Autowired
    private ClassgradesServiceImpl iClassgradesService;


    /*年级的添加
    * */
    @RequestMapping("/classAdd")
    @ResponseBody
    public void classAdd(Classgrades classgrades){
       iClassgradesService.save(classgrades);
    }




    /*年级的修改之前
    * */
    @RequestMapping("/classToUpdate")
    @ResponseBody
    public void classToUpdate(Integer classId){
        iClassgradesService.getById(classId);
    }

    /*年级的查询
    * */
    @RequestMapping("/classSelect")
    @ResponseBody
    public LayuiUtils classSelect(){
        LayuiUtils layuiUtils=new LayuiUtils();
        List<Classgrades> list=iClassgradesService.list();
        layuiUtils.setCode(0);
        layuiUtils.setMsg("成功");
        layuiUtils.setCount(list.size());
        layuiUtils.setData(list);
        return  layuiUtils ;
    }

}
